<?php

/**
 * ProwadzacyMetaData filter form base class.
 *
 * @package    edmuch
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseProwadzacyMetaDataFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'user_id'                   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)),
      'external_file_location'    => new sfWidgetFormFilterInput(),
      'algorithm_for_password'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'salt_for_password'         => new sfWidgetFormFilterInput(),
      'password_to_external_file' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'user_id'                   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('User'), 'column' => 'id')),
      'external_file_location'    => new sfValidatorPass(array('required' => false)),
      'algorithm_for_password'    => new sfValidatorPass(array('required' => false)),
      'salt_for_password'         => new sfValidatorPass(array('required' => false)),
      'password_to_external_file' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('prowadzacy_meta_data_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ProwadzacyMetaData';
  }

  public function getFields()
  {
    return array(
      'id'                        => 'Number',
      'user_id'                   => 'ForeignKey',
      'external_file_location'    => 'Text',
      'algorithm_for_password'    => 'Text',
      'salt_for_password'         => 'Text',
      'password_to_external_file' => 'Text',
    );
  }
}
